﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Comod_DrawPrint1 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string title="礼品库存信息";
        if (!IsPostBack)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                ZSql zsql = new ZSql();
                ZSql count = new ZSql();
                ZSql man = new ZSql();
             string sql = "select * from CS_Gifts";
                if (Request["id"]=="1")
                {
                    sql += " where IsOut=1";
                    title = "赠品信息";
                }
                
   
                zsql.Open(sql);
                DataTable dt = new DataTable();
                string strTable = "";
                dt = zsql.m_table;
            
                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        strTable += "<div align=\"center\">" + title + "</div>";
                        strTable += "<table width=\"97%\" border=\"1\"><tr><td align=\"center\">商品名称</td><td align=\"center\">库存数量</td><td align=\"center\">单价</td><td align=\"center\">入库人</td><td align=\"center\">描述</td></tr>";
                       
                        for (int i = 0; i < zsql.m_table.Rows.Count; i++)
                        {
                            strTable += "<tr><td align=\"center\">" + zsql.m_table.Rows[i]["GiftsName"].ToString() + "</td><td align=\"center\">" + zsql.m_table.Rows[i]["Num"].ToString() + "</td><td align=\"center\">" + zsql.m_table.Rows[i]["Price"].ToString().Substring(0, zsql.m_table.Rows[i]["Price"].ToString().Length - 2) + "</td><td align=\"center\">" + zsql.m_table.Rows[i]["EditName"].ToString() + "</td><td>"+zsql.m_table.Rows[i]["Content"].ToString()+"</td></tr>";
                          
                        }
                        strTable += "</table>";
                    }
                }
                zsql.Close();
                count.Close();
                lblTable.Text = strTable;
            }
        }
    }
}
